<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		
		<!-- tomcat清除缓存的问题 -->
		<meta http-equiv="Expires" content="0" />
        <meta http-equiv="kiben" content="no-cache"/>
        
		<title></title>
		<link href="css/style.css" rel="stylesheet" type="text/css" />
		<script language="javascript" src="view/shell/login.js?version=20081112050245"></script> 
		<script type="text/javascript" src="My97DatePicker/WdatePicker.js" ></script>
		<script type="text/javascript">
			function searchByConditon1(num1,num2,type){
				var myForm = document.getElementById("myForm");
				if(type=='page'){
					myForm.action = "searchClaimVoucher.action?page="+num1+"&currentGroup="+num2+"&type=page";
				}else if(type=='group'){
					myForm.action = "searchClaimVoucher.action?page="+num1+"&currentGroup="+num2+"&type=group";
				}
				myForm.submit();
			}
			function searchByDate(){
				var myForm = document.getElementById("myForm");
				myForm.action = "searchClaimVoucher.action?type=newSearch";
				var d=document.getElementById("time").value;
				if(d.length==0){
					alert("请选择要查询的月份");
					return false;
				}else{
					document.getElementById("time").value=d+'-1';
					myForm.submit();
				}
			}
			function deleteClaimVoucher(id){
				if(confirm("要删除该条信息？")){
					var myForm = document.getElementById("myForm");
					myForm.action ="delete.action?claimVoucher.id="+id;
					myForm.submit();
				}else{
					return ;
				}
			}
		</script>
	</head>
	<body>

	<s:if test="%{#session.employee!=null}">
		<div class="status">
			<div>
				${sessionScope.employee.sysPosition.nameCn}
				${sessionScope.employee.name}登录成功
				<br />
				<s:if test="%{#session.employee.sysPosition.nameCn=='员工'}">
					<a href=staff.jsp>添加报销单信息</a>
				</s:if>
			</div>
		</div>
		<form id="myForm" name="myForm" method="post">
			<div class="action">
						报销单列表
						<div class="pages">
							<table width="90%" border="0" cellspacing="0" cellpadding="0"class="list">
								<tr>
									<td>编号</td>
									<td>填报日期</td>
									<td>填报人</td>
									<td>总金额</td>
									<td>状态</td>
									<td>操作</td>
								</tr>
								
								<s:iterator value="#session.pageBean.list" id="pl">
									<tr>
										<td><s:property value="id" /></td>
										<td><s:date name="createTime" format="yyyy-MM-dd" /></td>
										<td><s:property value="sysEmployeeByCreateSn.name"/></td>
										<td>￥<s:property value="totalAccount" /></td>
										<td><s:property value="status" /></td>									
										<td>
											<s:if test="%{#session.employee.sysPosition.nameCn=='员工'}">										
												<s:if test="%{status == '已打回'||status == '新创建'}">
													<a href="edit.action?claimVoucher.id=<s:property value="id"/>">修改</a>
												</s:if>
												<s:else>修改</s:else>
												
												<s:if test="%{status != '已提交'&&status != '已审批'&&status != '已付款'&&status != '已终止'}">
													<a href="#" onclick="deleteClaimVoucher('<s:property value="id"/>')">删除</a>
												</s:if>
												<s:else>删除</s:else>
												
												<s:if  test="%{status=='已打回' || status=='新创建'}">
													<a href="submit1.action?claimVoucher.id=<s:property value="id"/>">提交1----</a>
												</s:if>
												<s:else>提交1</s:else>
												
												<s:if  test="%{status!='已打回' || status!='新创建'}">
													<a href="view.action?claimVoucher.id=<s:property value="id"/>">查看</a>
												</s:if>
												<s:else>查看</s:else>
												
						
											</s:if>	
											
											<s:elseif test="%{#session.employee.sysPosition.nameCn=='部门经理'}">
												<s:if test="%{status=='已提交'}">
													<s:if test="%{sysEmployeeByNextDealSn.sn==#session.employee.sn}">
														<a href="toCheck.action?claimVoucher.id=<s:property value="id"/>">提交</a>
													</s:if>												
												</s:if>
												<s:else>
													<a href="view.action?claimVoucher.id=<s:property value="id"/>">查看</a>
												</s:else>
											</s:elseif>
											
											<s:elseif test="%{#session.employee.sysPosition.nameCn=='总经理'}">
												<s:if test="%{status=='已提交'}">
													<s:if test="%{sysEmployeeByNextDealSn.sn==#session.employee.sn}">
														<a href="toCheck.action?claimVoucher.id=<s:property value="id"/>">提交</a>
													</s:if>												
												</s:if>
												<s:else>
													<a href="view.action?claimVoucher.id=<s:property value="id"/>">查看</a>
												</s:else>
											</s:elseif>
											
											<s:elseif test="%{#session.employee.sysPosition.nameCn=='财务'}">
												<s:if test="%{status=='已审批'}">
													<s:if test="%{sysEmployeeByNextDealSn.sn==#session.employee.sn}">
														<a href="toCheck.action?claimVoucher.id=<s:property value="id"/>">提交</a>
													</s:if>												
												</s:if>
												<s:else>
													<a href="view.action?claimVoucher.id=<s:property value="id"/>">查看</a>
												</s:else>
											</s:elseif>
									</tr>	
								</s:iterator>
							</table>
							<table>
								<tr>
									<td>
										<s:if test="%{#session.pageBean.currentPage > 1}">
											<a href="#" onclick="searchByConditon1(1,1,'page')">&nbsp;&nbsp;【首页】&nbsp;&nbsp;</a>
										</s:if>
									</td>
									<td>
										<s:if test="%{#session.pageBean.currentGroup > 1}">
											<a href="#"
												onclick="searchByConditon1(0,<s:property value="%{#session.pageBean.currentGroup-1}"/>,'group')">&nbsp;&nbsp;【前5页】&nbsp;&nbsp;</a>
										</s:if>
									</td>
									<td>
										<s:iterator id="p" value="#session.pageBean.pageList">
											<a href="#"
												onclick="searchByConditon1(<s:property value="p"/>,<s:property value="%{#session.pageBean.currentGroup}"/>,'page')"><s:property
													value="p" />
											</a>
										</s:iterator>
									</td>
									<td>
										<s:if
											test="%{#session.pageBean.currentGroup <#session.pageBean.totalGroup}">
											<a href="#"
												onclick="searchByConditon1(0,<s:property value="%{#session.pageBean.currentGroup+1}"/>,'group')">&nbsp;&nbsp;【后5页】&nbsp;&nbsp;</a>
										</s:if>
									</td>
									<td>
										<s:if
											test="%{#session.pageBean.currentPage != #session.pageBean.totalPage&&#session.pageBean.totalPage!=0}">
											<a href="#"
												onclick="searchByConditon1(<s:property value="%{#session.pageBean.totalPage}"/>,<s:property value="%{#session.pageBean.totalGroup}"/>,'page')">&nbsp;&nbsp;【末页】&nbsp;&nbsp;</a>
										</s:if>
									</td>
									<td>
										【第
										<s:property value="#session.pageBean.currentPage" />
										页 】/【共
										<s:property value="#session.pageBean.totalPage" />
										页】【共
										<s:property value="#session.pageBean.allRow" />
										条】
									</td>
								</tr>
							</table>
						</div>
				</div>
		</form>
		</s:if>
		<s:else> 
		<h1>
			你还没登录，请您先登录。
			<a href="login.jsp">返回</a>
		</h1>
		</s:else>
	</body>
</html>
